home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DMAKE38B.ARJ / ENVIRON.C < prev    next >
C/C++ Source or Header  |  1992-01-23  |  473b  |  36 lines

  1. /*LINTLIBRARY*/
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. #include "alloc.h"
  6.  
  7. /* ZTC++ doesn't have environ, so we have to create one. */
  8.  
  9. extern char *_envptr;
  10. char **environ = { NULL };
  11.  
  12. void
  13. make_env()
  14. {
  15.     int        i;
  16.     char    *cp;
  17.  
  18.     for (i = 0, cp = _envptr; *cp; i++, cp += strlen(cp)+1)
  19.         ;
  20.  
  21.     TALLOC(environ, i+1, char*);
  22.  
  23.     for (i = 0, cp = _envptr; *cp; i++, cp += strlen(cp)+1)
  24.         environ[i] = cp;
  25.  
  26.     return;
  27. }
  28.  
  29. void
  30. free_env()
  31. {
  32.     FREE(environ);
  33.  
  34.     return;
  35. }
  36.